<template>
  <div>
    <div>
        a<input type="text" v-model="name" name="" id="" @input="add"/>
    </div>
    <div>{{ count }}</div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      name: '',
      a: 0,
      b: 2
    }
  },
  methods: {
    add () {
      this.a = this.name.length
    }
  },
  computed: {
    count: function () {
      return this.a + this.b
    }
  }
}
</script>
